Quickstart: Tabular Compression with the python API ==================================================== This tutorial uses :std:ref:`Heaviside in quickstart` provided with NeurEco installation. To work with the Tabular NeurEco models in Python, import **NeurEcoTabular** library: .. code-block:: python from NeurEco import NeurEcoTabular as Tabular Import numpy to handle the data sets: .. code-block:: python import numpy as np Load the data sets(see :std:ref:`Data preparation for NeurEco Compression python API` and :std:ref:`Heaviside in quickstart`): .. code-block:: python x_train = np.genfromtxt("x_train.csv", delimiter=";", skip_header=True) x_test = np.genfromtxt("x_test.csv", delimiter=";", skip_header=True) To initialize a NeurEco object to handle the **Compression** problem: .. code-block:: python compression_model = Tabular.Compressor() To build the model, call method **build** with the parameters set for the problem under consideration (see :std:ref:`Build NeurEco Compression model with the Python API`): .. code-block:: python compression_model.build(x_train, # the rest of the parameters are optional write_model_to='./HeavisideModel/Heaviside.ednn', write_compression_model_to='./HeavisideModel/HeavisideCompressor.ednn', write_decompression_model_to='./HeavisideModel/HeavisideUncompressor.ednn', compress_tolerance=0.02, checkpoint_address='./HeavisideModel/Heaviside.checkpoint') .. note:: For detailed documentation on **build**, see :std:ref:`Build NeurEco Compression model with the Python API` To evaluate the NeurEco Model on the testing data, call **evaluate** method: .. code-block:: python neureco_test_outputs = compression_model.evaluate(x_test) .. note:: For detailed documentation on **evaluate**, see :std:ref:`Evaluate NeurEco Compression model with the Python API` To export the model to the chosen format (*embed* license is required), run one of the following commands: .. code-block:: python compression_model.export_c("./HeavisideModel/Heaviside.h", precision="double") compression_model.export_onnx("./HeavisideModel/Heaviside.onnx", precision="float16") compression_model.export_fmu("./HeavisideModel/Heaviside.fmu") compression_model.export_vba("./HeavisideModel/Heaviside.bas", precision="float") Export to these formats requires *embed* license. .. note:: For detailed documentation on **export**, see :std:ref:`Export NeurEco Compression model with the Python API` When the model is not needed any more, delete it from the memory: .. code-block:: python compression_model.delete() .. note:: For detailed documentation on Tabular Compression with the python API, see :std:ref:`Tabular Compression with the Python API`.